//
//  RecodeViewController.m
//  tristana
//
//  Created by 李康 on 2021/1/5.
//  Copyright © 2021 李康. All rights reserved.
//

#import "RecodeViewController.h"
#import "Otherthings.h"
#import <MJCSegmentInterface/MJCSegmentInterface.h>

#import "TiaoZiListVC.h"
#import "Otherthings.h"

@interface RecodeViewController ()<MJCSegmentDelegate>
@property (nonatomic, strong) MJCSegmentInterface *mainSegmentView;

@property (nonatomic, strong) TiaoZiListVC *JTVC;
@property (nonatomic, strong) TiaoZiListVC *QTVC;
 
@end

@implementation RecodeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initAllPropertys];
    [self setupUI];
}

#pragma mark - Public Method

#pragma mark - Life Cycle

#pragma mark - Data Query

#pragma mark - Notification

#pragma mark - UI
- (void)initAllPropertys {
    NSDictionary *dataDic1 = @{ @"money":@"1756",
                               @"nameOne":@"张三",
                               @"mobileOne":@"17912312232",
                               @"nameTwo":@"小王",
                               @"mobileRTwo":@"17900000000",
                               @"timeOne":@"2021-01-02",
                               @"timeTwo":@"2021-05-02"};
    
    NSDictionary *dataDic2 = @{ @"money":@"255",
                               @"nameOne":@"张三",
                               @"mobileOne":@"17912312232",
                               @"nameTwo":@"小王",
                               @"mobileRTwo":@"17900000000",
                               @"timeOne":@"2021-01-02",
                               @"timeTwo":@"2021-05-02"};
    
    NSDictionary *dataDic3 = @{ @"money":@"8986",
                               @"nameOne":@"张三",
                               @"mobileOne":@"17900000000",
                               @"nameTwo":@"小王",
                               @"mobileRTwo":@"17912312232",
                               @"timeOne":@"2021-01-02",
                               @"timeTwo":@"2021-05-02"};
    NSMutableArray *arr1 = [[NSUserDefaults standardUserDefaults] objectForKey:@"recordData1"];
    if ( IsArrEmpty(arr1)) {
        arr1 = [NSMutableArray array];
        [arr1 addObject:dataDic1];
        [arr1 addObject:dataDic2];
        [[NSUserDefaults standardUserDefaults] setObject:arr1 forKey:@"recordData1"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
    NSMutableArray *arr2 = [[NSUserDefaults standardUserDefaults] objectForKey:@"recordData2"];
    if ( IsArrEmpty(arr2)) {
        arr2 = [NSMutableArray array];
        [arr2 addObject:dataDic3];
        [[NSUserDefaults standardUserDefaults] setObject:arr2 forKey:@"recordData2"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
}

- (void)setupUI {
    
    self.JTVC = [[TiaoZiListVC alloc] init];
    self.QTVC = [[TiaoZiListVC alloc] init];
    
    self.JTVC.type = 0;
    self.QTVC.type = 1;

    self.mainSegmentView = [MJCSegmentInterface jc_initWithFrame:CGRectMake(0,NavigationBarHeight,ScreenWidth, ScreenHeight -NavigationBarHeight) titlesArray:@[@"我的借条",@"我的欠条"] childControllerArray:@[self.JTVC, self.QTVC] interFaceStyleToolsBlock:^(MJCSegmentStylesTools *jc_tools) {
        jc_tools.
        jc_titlesViewBackColor([UIColor whiteColor]).
        jc_loadAllChildViewEnabled(YES).
        jc_titleBarStyles(MJCTitlesScrollStyle).
        jc_itemTextNormalColor([UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]).
        jc_itemTextSelectedColor([UIColor colorWithRed:127/255.0 green:114/255.0 blue:232/255.0 alpha:1.0]).
        jc_itemTextFontSize(15).
        jc_indicatorFollowEnabled(YES).
        jc_indicatorColorEqualTextColorEnabled(YES).
        jc_itemSelectedSegmentIndex(0).
        jc_childScollEnabled(YES).
        jc_indicatorFrame(CGRectMake(0, 50-12, 80, 2)).
        jc_indicatorsAnimalsEnabled(YES).
        jc_childScollAnimalEnabled(YES).
        jc_itemTextGradientEnabled(YES).
        jc_titlesViewFrame(CGRectMake(0, 0, ScreenWidth, 45)).
        jc_titlesViewBackImage([UIImage imageNamed:@"GLYinYing.png"]);
        
    } hostController:self];
    self.mainSegmentView.delegate = self;
    [self.view addSubview:self.mainSegmentView];
}
#pragma mark - Delegate

#pragma mark - Private Method

#pragma mark - Overwrite Method

#pragma mark - Event Response

#pragma mark - Setter

#pragma mark - Getter
@end
